from flask_restful.reqparse import RequestParser
from flask_restful import fields

filter_user_parser = RequestParser()
filter_user_parser.add_argument('username', type=str, required=False)
filter_user_parser.add_argument('mobile', type=str, required=False)
filter_user_parser.add_argument('email', type=str, required=False)

create_user_parser = RequestParser()
create_user_parser.add_argument('username', type=str, required=False)
create_user_parser.add_argument('mobile', type=str, required=False)
create_user_parser.add_argument('email', type=str, required=False)
create_user_parser.add_argument('password', type=str, required=True)

response_columns = ['id', 'username', 'mobile', 'email']
detail_response_columns = response_columns + ['creator', 'modifier']

response_user_fields = {
    'id': fields.Integer,
    'username': fields.String,
    'mobile': fields.String,
    'email': fields.String,
    'is_delete': fields.Integer,
    'role': fields.Nested({
        'id': fields.Integer(),
        'name': fields.String()
    }),
    'created_by': {
        'id': fields.Integer(attribute='creator', default=None),
        'username': fields.String(attribute='creator_name', default=None)
    },
}
